﻿//
//  Windows_libc
//
//  Created by  cc_team(陈旭，陈曦) qq:511272827.
//  Copyright 2011 cc_team. All rights reserved.
//
#ifndef CC_COMMON_H
#define	CC_COMMON_H

// my younger brother, 陈旭
#define XUCHEN
// myself, 陈曦
#define XICHEN

// default C library func call conversion
#define __cdecl

#ifndef NULL
#define NULL 0
#endif

#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

// increase void * pointer as a char *
#define INC_VOID_STAR(p, type) ((type)(p) = (type)(p) + 1)

// converted to a string
#define TO_STR(s)	#s

// catenate the two value to a string
#define CAT_STR(s1,s2)	s1##s2

// converted to a bool str: "true" or "false"
#define TO_BOOL_STR(b)	((b) ? "true" : "false")

// in , out , inout flags
#define IN
#define	OUT
#define INOUT

// extern "C" macro
#ifdef __cplusplus
#define __BEGIN_DECLS			extern "C" {
#define __END_DECLS				}
#else
#define __BEGIN_DECLS			
#define __END_DECLS				
#endif

// do nothing
#define DO_NOTHING

// common size
#define KB			1024
#define MB			(1024 * 1024L)
#define GB			(1024 * 1024 * 1024LL)
#ifndef PAGE_SIZE
#define PAGE_SIZE	(4 * KB)
#endif

// get the size of the array
#define GET_ARR_SIZE(arr)		(sizeof(arr) / sizeof(arr[0]))

// for cc_time
#define _CRTALLOC(x) __declspec(allocate(x))
typedef int  (__cdecl *_PIFV)(void);
#pragma section(".CRT$XIC",long,read)

#ifdef __cplusplus
extern "C" {
#endif


#ifdef __cplusplus
}		// extern "C"
#endif

#endif